package api.clock;

import android.app.Activity;
import android.content.Context;

import java.lang.ref.SoftReference;

/**
 * china_lib
 *
 * @author liwenbo
 */
public abstract class DuManagerApi_clock {

    public static String clazz = "api.clock.DuAdManager_clock";

    public abstract boolean ConfigDuadNetWork(Context context);

    public abstract void jumpToAdWall(Activity act);

    private static SoftReference<DuManagerApi_clock> sf;

    /**
     * duSDK海外 in 锁屏
     * @return
     */
    public synchronized static DuManagerApi_clock getInstance(Context ct) {

        if (sf == null || sf.get() == null) {
            Object o = null;
            try {
                o = Class.forName(clazz).newInstance();
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            } catch (InstantiationException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            }
            if (o != null) {
                DuManagerApi_clock o2 = (DuManagerApi_clock) o;
                if (!o2.initSuccess) {
                    o2.initSuccess = o2.ConfigDuadNetWork(ct);
                }
                sf = new SoftReference<DuManagerApi_clock>(o2);
                return o2;
            }
        }
        return sf == null ? null : sf.get();
    }

    private boolean initSuccess = false;

}
